<?php
/**
 * UserForm.php
 * Infomation account order
 */
class UserForm extends CFormModel {
    public $user_id;
    public $firstname;
    public $lastname;
    public $company;
    public $phone;
    public $address1;
    public $address2;
    public $city;
    public $state;
    public $zip;
    public $email;
    public $password;
    public $existing=0;

    /**
     * Model rules
     * @return array
     */
    public function rules() {
        return array(
            array('firstname, lastname, company, address1, city, state,existing,zip','required'),
            array('email, password','required','on'=>'insert'),
            array('firstname, lastname, company, address1, address2, city, state,password','length','max'=>60),
            array('phone','length','max'=>32),
            array('email','email'),
            array('password','length','min'=>8),
            array('existing, user_id','numerical','integerOnly'=>true)
        );
    }

    public static function getExistingArray() {
        return array(
            0 => 'Existing Customer',
            1 => 'New Customer'
        );
    }
}
